package com.xwintop.xTransfer.receiver.bean;

import lombok.Data;
import org.apache.pulsar.client.api.SubscriptionType;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: ReceiverConfigPulsar
 * @Description: Pulsar接收器配置
 * @author: xufeng
 * @date: 2021/12/12 17:43
 */

@Data
public class ReceiverConfigPulsar implements ReceiverConfig {
    private String serviceName = "receiverPulsar";//对应服务名称
    private String id;//如果留空则系统自动分配
    /** 是否开启 */
    private boolean enable = true;
    /** 是否异步执行 */
    private boolean async = false;
    /** 是否发生异常时退出任务 */
    private boolean exceptionExit = false;

    private String serviceUrl = "pulsar://localhost:6650";
    private Integer ioThreads = 10;
    private Integer listenerThreads = 10;
    private boolean enableTcpNoDelay = false;
    private Integer keepAliveIntervalSec = 20;
    private Integer connectionTimeoutSec = 10;
    private Integer operationTimeoutSec = 15;
    private long startingBackoffIntervalMs = 100;
    private long maxBackoffIntervalSec = 10;
    private String consumerNameDelimiter = "";
    private String namespace = "default";
    private String tenant = "public";
    private String tlsTrustCertsFilePath = null;
    private List<String> tlsCiphers = new ArrayList<>();
    private List<String> tlsProtocols = new ArrayList<>();
    private String tlsTrustStorePassword = null;
    private String tlsTrustStorePath = null;
    private String tlsTrustStoreType = null;
    private boolean useKeyStoreTls = false;
    private boolean allowTlsInsecureConnection = false;
    private boolean enableTlsHostnameVerification = false;
    private String tlsAuthCertFilePath = null;
    private String tlsAuthKeyFilePath = null;
    private String tokenAuthValue = null;

    private String topic;
    private int deadLetterPolicyMaxRedeliverCount = -1;
    private int maxRedeliverCount;
    private String retryLetterTopic;
    private String deadLetterTopic;
    private long ackTimeoutMs = 0;
    private String consumerName = null;
    private String subscriptionName;
    String subscriptionType = SubscriptionType.Exclusive.name();

    private String fileNameField = "X_TRANSFER_FILE_NAME";//文件名获取字段
}
